package cn.com.open.errorquestion.mapper;

import cn.com.open.errorquestion.model.AnswerQuestionLog;
import cn.com.open.errorquestion.vo.ErrorQuestionVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ErrorQuestionMapper {


    /**
     * 保存作答记录
     * @param answerData
     */
    @Insert("INSERT INTO error_question\n" +
            " (id,paperId,questionId,questionType,answerStates,answerScore,questionScore,contentJson,createTime,questionAnswer,answerDetail,questionDifficult,questionPerceiver,questionCategory)\n" +
            " VALUES\n" +
            " (#{id},#{paperId},#{questionId},#{questionType},#{answerStates},#{answerScore},#{questionScore},#{contentJson},now(),#{questionAnswer},#{answerDetail},#{questionDifficult},#{questionPerceiver},#{questionCategory})")
    void save(AnswerQuestionLog answerData);

    @Delete("DELETE FROM error_question WHERE questionId = #{questionId}")
    void delete(AnswerQuestionLog answerData);


    @Select("<script>" +
            "SELECT id,contentJson,answerDetail FROM error_question WHERE 1=1 \n" +
            "" +
            "" +
            "" +
            "" +
            "" +
            "" +
            "</script>")
    List<ErrorQuestionVo> list();
}
